package com.hyt.it.ogt.controller.ykcj.grade;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.exception.CustomException;
import com.hyt.it.ogt.ykcj.common.utils.StringUtils;
import com.hyt.it.ogt.ykcj.domain.vo.QueryExamineeGradeVo;
import com.hyt.it.ogt.ykcj.domain.vo.ServantGradeAnalysisRsp;
import com.hyt.it.ogt.ykcj.domain.vo.ServantGradeSubjectAnalysisVo;
import com.hyt.it.ogt.ykcj.service.grade.IServantGradeAnalysisDataService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;

/**
 * 考试成绩数据分析Controller
 * 
 * @author admin
 * @date 2021-06-24
 */
@Api(tags = "grade.5.公务员考试成绩数据分析", value = "公务员考试成绩数据分析请求接口")
@ApiSort(value = 205)
@RestController
@RequestMapping("/grade/servantAnalysis")
public class ServantGradeAnalysisDataController extends BaseController {
    @Autowired
    private IServantGradeAnalysisDataService servantGradeAnalysisDataService;

    /**
     * 查询公务员考试成绩数据分析列表
     */
    @ApiOperation("查询公务员考试成绩数据分析列表--总计、层级")
    //@PreAuthorize("@ss.hasPermi('grade:analysis:queryAnalysisData')")
    @GetMapping("/queryServantAnalysisData")
    public AjaxResult queryAnalysisData(QueryExamineeGradeVo queryExamineeGradeVo) {
        ServantGradeAnalysisRsp rsp = servantGradeAnalysisDataService.selectServantGradeAnalysisData(queryExamineeGradeVo);
        return AjaxResult.success(rsp);
    }

    /**
     * 查询公务员考试成绩数据分析列表
     */
    @ApiOperation("查询公务员考试成绩数据分析列表-按科目")
    //@PreAuthorize("@ss.hasPermi('grade:analysis:queryAnalysisData')")
    @GetMapping("/querySubjectAnalysisData")
    public AjaxResult querySubjectAnalysisData(QueryExamineeGradeVo param) {
        if(StringUtils.isEmpty(param.getSubjectId())){
            throw new CustomException("科目id不能为空");
        }
        ServantGradeSubjectAnalysisVo rsp = servantGradeAnalysisDataService.selectServantSubjectGradeAnalysisData(param);
        return AjaxResult.success(rsp);
    }


}
